<?php
class DailyreportController extends Zend_Controller_Action
{
	public function init()
	{
		
	}
	
	public function indexAction()
	{
		$date	= $this->_request->getParam('d','');
		$dateReturn	= $this->_request->getParam('dreturn','');
	
		if($date=='')
		{
			$nextWeek = time() - (1 * 24 * 60 * 60);
			$date = date('dmY', $nextWeek);
			$dateReturn = date('m/d/Y',  $nextWeek);
		}	
		
		$objDailyReport = new CDailyReport();
		$data =$objDailyReport->get($date);
		
		if($data =="")
		{ 
			$this->view->str = "<b>There is no data for daily report: " . $dateReturn ."</b>" ;
			$this->view->dateDownload= "";
		}
		else
		{
			$this->view->str = $data ;
			$this->view->dateDownload= $date;
		}	
		
		$this->view->date = $dateReturn;
	}
	
	public function viewOrderAction()
	{
		$filename		= $this->_request->getParam('filename','');	
		
		$objDailyReport = new CDailyReport();
		$data = $objDailyReport->getViewOrder($filename);
		
		if($data =="")
		{ 
			$this->view->str = "<b>There is no data for daily report item: </b>" ;
			$this->view->filename= "";
		}
		else
		{
			$this->view->str = $data ;
			$this->view->filename= $filename;
		}	
	}
}
?>
